package com.nopay.cdxphone.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.widget.CheckBox;

import androidx.annotation.NonNull;

import com.nopay.cdxphone.R;

public class DialogDialedStatus extends Dialog {

    private Activity mActivity;

    public DialogDialedStatus(@NonNull Activity context) {
        super(context, R.style.MyDialog);
        mActivity = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_dialed_status);

        findViewById(R.id.tv_dialog_cancel).setOnClickListener(v -> dismiss());
        findViewById(R.id.tv_dialog_confirm).setOnClickListener(v -> {
            dismiss();
            CheckBox cb_no = findViewById(R.id.cb_no);
            CheckBox cb_yes = findViewById(R.id.cb_yes);
            boolean statusNo =cb_no.isChecked();
            boolean statusYes = cb_yes.isChecked();

            if(onDialedStatusConfirmListener != null) onDialedStatusConfirmListener.onDialedStatusConfirm(statusNo, statusYes);
        });
    }

    private OnDialedStatusConfirmListener onDialedStatusConfirmListener;

    public DialogDialedStatus setOnDialedStatusConfirmListener(OnDialedStatusConfirmListener onDialedStatusConfirmListener) {
        this.onDialedStatusConfirmListener = onDialedStatusConfirmListener;
        return this;
    }

    public interface OnDialedStatusConfirmListener {

        void onDialedStatusConfirm(boolean statusNo, boolean statusYes);
    }
}
